package com.JaMorant.SSM.thc.service.impl;

import com.JaMorant.SSM.exception.GgktException;
import com.JaMorant.SSM.model.thc.PddOrder;
import com.JaMorant.SSM.thc.listener.PddOrderListener;
import com.JaMorant.SSM.thc.listener.PddOrderProductCostListener;
import com.JaMorant.SSM.thc.mapper.PddOrderMapper;
import com.JaMorant.SSM.thc.service.PddOrderService;
import com.JaMorant.SSM.vo.thc.GoodsConfigVo;
import com.JaMorant.SSM.vo.thc.PddOrderProductCostVo;
import com.JaMorant.SSM.vo.thc.PddOrderVo;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * <p>
 * 城市 服务实现类
 * </p>
 *
 * @author JaMorant
 * @since 2023-02-19
 */
@Service
public class PddOrderServiceImpl extends ServiceImpl<PddOrderMapper, PddOrder> implements PddOrderService {
    @Autowired
    private PddOrderListener pddOrderListener;

    @Autowired
    private PddOrderProductCostListener pddOrderProductCostListener;



    //课程分类导入
    @Override
    public void importData(MultipartFile file) {
        try {
            EasyExcel.read(file.getInputStream(),
                    PddOrderVo.class,
                    pddOrderListener).sheet()
                    .doRead();
        } catch (IOException e) {
            throw new GgktException(20001, "导入失败");
        }
    }
    @Override
    public void importDelivery(MultipartFile file) {
        try {
            EasyExcel.read(file.getInputStream(),
                            PddOrderProductCostVo.class,
                            pddOrderProductCostListener).sheet()
                    .doRead();
        } catch (IOException e) {
            throw new GgktException(20001, "导入失败");
        }
    }



}
